package com.atguigu.exam;

/**
 * @author xbd
 * @create 2021-05-25 18:32
 */
public class GetTime {
    public static void main(String[] args) {
        GetTime g1 = new GetTime();
        System.out.println(g1.getTime("abgsajhfabskjfjablkab", "ab"));
    }
    public int getTime(String str1, String str2){
        int count = 0;
        int len;
        while ((len = str1.indexOf(str2)) != -1){
            count++;
            str1 = str1.substring(len + str2.length());
        }
        return count;
    }
}
